package com.leetcode.LeetCode精选TOP面试题;

import java.util.HashSet;
import java.util.Set;

/**
 * @author 覃国强
 * @date 2022-07-12 15:41
 */
public class 题库_0217_存在重复元素 {

  static
  class Solution {
    public boolean containsDuplicate(int[] nums) {
      Set<Integer> set = new HashSet<>();
      for (int num : nums) {
        if (!set.add(num)) {
          return true;
        }
      }
      return false;
    }
  }

}
